Ext.define('MyBlog.view.NewEntryForm',{
	extend: 'Ext.form.Panel',
	title: 'new Entry Form',
	width: 350,
	height: 400,
	bodyPadding: 5,
	bodyBorder: false,
	alias: 'widget.newEntryForm',
	url: 'saveNewEntry.php',
	autoRender: true,
	layout: 'anchor',
    defaults: {
        anchor: '100%'
    },

    // The fields
    //defaultType: 'textfield',
    items: [{
        fieldLabel: 'Title',
        name: 'title',
		xtype: 'textfield',
        allowBlank: false
    },{
        fieldLabel: 'Entry',
        name: 'entry',
		xtype: 'textarea',
        allowBlank: false
    }],

    // Reset and Submit buttons
    buttons: [{
        text: 'Reset',
        handler: function() {
            this.up('form').getForm().reset();
        }
    }, {
		text: 'Submit',
		action: 'save'
        /*text: 'Submit',
        formBind: true, //only enabled once the form is valid
        disabled: true,
        handler: function() {
            var form = this.up('form').getForm();
            if (form.isValid()) {
                form.submit({
                    success: function(form, action) {
                       Ext.Msg.alert('Success', action.result.msg);
                    },
                    failure: function(form, action) {
                        Ext.Msg.alert('Failed', 'Fallo, cuack!!!');
                    }
                });
            }
        }*/
    }]
	
});